#include <stdio.h>
#include <stdarg.h>

void pp(char* fmt,...){
	va_list ap;
	char *sval;
	int iv;
	double dv;
	
	va_start(ap,fmt);
	char *p;
	for(p=fmt; *p; p++){
		if(*p !='%')
			continue;
		
		switch(*++p){
			case 'd':
				iv=va_arg(ap,int);
				printf("%d",iv);
				break;
			case 'f':
				dv=va_arg(ap,double);
				printf("%f",dv);
				break;
			case 's':
				sval=va_arg(ap,char*);
				for(;*sval;sval++)
					putchar(*sval);
				break;
			default:
				putchar(*p);
				break;
		}
	}
}

int main(){
	pp("hello %d,%f,%s",123,33.55,"hello");
	return 0;
}

